import Vue from 'vue'
import VueRouter, { RouteConfig } from 'vue-router'
import Home from "../views/Home/index.vue"
import Detail from "../views/Detail/index.vue"

import Classfy from "../views/Home/Classfy/index.vue"
import Main from "../views/Home/Main/index.vue"
import More from "../views/Home/More/index.vue"
import My from "../views/Home/My/index.vue"
import Shopcar from "../views/Home/Shopcar/index.vue"

Vue.use(VueRouter)

const routes: Array<RouteConfig> = [
  {
    path: '/',
    redirect:"/home/main"
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children:[{
      path:'/home/classfy',
      name:'分类',
      component:Classfy
    },{
      path:'/home/main',
      name:'主页',
      component:Main
    },{
      path:'/home/more',
      name:'发现',
      component:More
    },{
      path:'/home/my',
      name:'我的',
      component:My
    },{
      path:'/home/shopcar',
      name:'购物车',
      component:Shopcar
    }]
  },{
    path: '/detail',
    name: 'Detail',
    component: Detail,
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
